const express = require("express")
const app = express()

app.use((req, res, next) => {
  console.log('有人请求的服务器')
  next()
})

app.get('/students', (req, res) => {
  console.log('hello')
  const students = [
    {id:'001', name:'tom', age:18},
    {id:'002', name:'jerry',  age:28},
    {id:'003', name:'tony', age:35},
  ]

  res.send(students)
})

app.listen(8000, (err) => {
  if(!err) console.log('服务器1启动成功, 启动地址:http://localhost:8000/students ')
})